import request from '@/utils/request'

//从配置中获取业务的地址
import {baseUrlConfig} from '@/config/config'
const basePath = baseUrlConfig.processBaseUrl;

interface Order{
    column:String;
    method:String;
}
export interface PageListType {
    pageNum:number;
    pageSize:number;
    condition: {
        alarmType: String;
        terminal?:String;
        createTime?:String;
        order?:Array<Order>;
    }
}

// 获取下级文件目录
export const getChildrenDirectory = (catalogueId :string) => {
    return request({
        url: basePath + `/knowledge/documentCatalogue/getTree?catalogueId=${catalogueId}`,
        method: "get",
    })
};
export const getChildrenDirectory1 = (catalogueId :string,isValid:any) => {
  return request({
    url: basePath + `/knowledge/documentCatalogue/getTree?catalogueId=${catalogueId}`+'&isValid='+isValid,
    method: "get",
  })
};
//增加下级
export const addSubordinates = (data: any) => {
    return request ({
        url: basePath + `/knowledge/documentCatalogue/addSub`,
        method: "post",
        data
    })
};

// 修改
export const updateSubordinates = (data: any) => {
    return request ({
        url: basePath + `/knowledge/documentCatalogue/update`,
        method: "post",
        data
    })
};

// 删除
export const deleteSubordinates = (id :string) => {
    return request({
        url: basePath + `/knowledge/documentCatalogue/delete/${id}`,
        method: "delete",
    })
};

// 历史记录
export const getHistory = (id :string) => {
    return request({
        url: basePath + `/knowledge/documentCatalogue/history?id=${id}`,
        method: "get",
    })
};

//控件转移
export const transferSubordinates = (data :any) => {
    return request({
        url: basePath + `/knowledge/documentCatalogue/remove`,
        method: "put",
        data
    })
};
